Skip to content

Conversation

@shabbskagalwala
Copy link
Contributor

Issue #, if available: aws-controllers-k8s/community#2655

Description of changes:

Allows to add a resource policy to a dynamodb table.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow ack-prow bot requested review from jlbutler and michaelhtm October 17, 2025 18:57
@ack-prow ack-prow bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 17, 2025
@ack-prow
Copy link

ack-prow bot commented Oct 17, 2025

Hi @shabbskagalwala. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@a-hilaly
Copy link
Member

/ok-to-test

@ack-prow ack-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 17, 2025
@shabbskagalwala shabbskagalwala force-pushed the add-resource-policy branch 2 times, most recently from f868396 to 2266683 Compare October 17, 2025 19:30
Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @shabbskagalwala ! this looks great overall - i left a few comments in line :)

Comment on lines 698 to 705
if ackcompare.HasNilDifference(a.ko.Spec.ResourcePolicy, b.ko.Spec.ResourcePolicy) {
delta.Add("Spec.ResourcePolicy", a.ko.Spec.ResourcePolicy, b.ko.Spec.ResourcePolicy)
} else if a.ko.Spec.ResourcePolicy != nil && b.ko.Spec.ResourcePolicy != nil {
if *a.ko.Spec.ResourcePolicy != *b.ko.Spec.ResourcePolicy {
delta.Add("Spec.ResourcePolicy", a.ko.Spec.ResourcePolicy, b.ko.Spec.ResourcePolicy)
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this block the same the original generated code when we set compare.is_ignore: false ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we do have a way to parse IAM policies that gets formatted/reformatted by the AWS APIs, checkout https://github.com/aws-controllers-k8s/iam-controller/blob/main/pkg/resource/role/hooks.go#L398-L432

}
if !delta.DifferentExcept("Spec.Tags") {

// ResourcePolicy can be updated independently of table state
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shabbskagalwala can we also get some basic e2e tests for this feature? a test case here would be great https://github.com/aws-controllers-k8s/dynamodb-controller/blob/main/test/e2e/tests/test_table.py

@shabbskagalwala shabbskagalwala force-pushed the add-resource-policy branch 4 times, most recently from 78a6f96 to 2c79edd Compare October 21, 2025 04:48
@a-hilaly
Copy link
Member

/retest

1 similar comment
@a-hilaly
Copy link
Member

/retest

@shabbskagalwala shabbskagalwala force-pushed the add-resource-policy branch 2 times, most recently from 8aaf651 to 37b1875 Compare October 21, 2025 20:41
@shabbskagalwala
Copy link
Contributor Author

/retest

Copy link
Contributor

@knottnt knottnt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shabbskagalwala Thanks for the contribution!

)
rm.metrics.RecordAPICall("DELETE", "DeleteResourcePolicy", err)
if err != nil {
var policyNotFoundErr *svcsdktypes.PolicyNotFoundException
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p: It would be good to add a unit test validating this behavior.

@ack-prow
Copy link

ack-prow bot commented Oct 22, 2025

@shabbskagalwala: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
dynamodb-verify-attribution fb7f703 link false /test dynamodb-verify-attribution

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@ack-prow ack-prow bot added the approved label Oct 22, 2025
@a-hilaly
Copy link
Member

/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2025
@ack-prow
Copy link

ack-prow bot commented Oct 23, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-hilaly, shabbskagalwala

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow bot merged commit 888fee6 into aws-controllers-k8s:main Oct 23, 2025
6 of 7 checks passed
@shabbskagalwala shabbskagalwala deleted the add-resource-policy branch October 23, 2025 04:16
ack-prow bot pushed a commit that referenced this pull request Oct 23, 2025
…155)

Issue #, if available: aws-controllers-k8s/community#2655

Description of changes: Release PR for #154

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants